<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let p1 = new Promise((resolve,reject)=>{
            setTimeout(
                ()=>{
                    console.log("异步1");
                    reject(11);
                },2000
            )
        })

        let p2 = new Promise((resolve,reject)=>{
            setTimeout(()=>{
                console.log('异常2');
                resolve(22);
            },1500)
        })

        let p3 = new Promise((resolve,reject)=>{
            setTimeout(function(){
                console.log('异常3');
                resolve(33);
            },1000)
        })

        let p4 = Promise.all([p1,p2,p3]);
        // p1 p2 p3 都为成功状态，namep4也是成功状态，如果p1 p2 p3 其中一个为
        // 失败状态,那么p4也是失败状态
        p4.then(
            function(res){
                console.log('p4成功',res);
            },
            function(res){
                console.log("p4失败",res);
            }
        )
    </script>
</body>
</html>